use strict;
use warnings;
use XML::LibXML;
use Data::Dumper;


my $parser = XML::LibXML->new();
my $doc    = $parser->parse_file("../lib/Bio/Rambam/Proteomics/Formats/Files/unimod.xml");
my %mods;
print "Unimod name 	Unimod long name	Unimod ID	Visible	Delta Mass\n";
foreach my $modification ($doc->findnodes('//umod:unimod/umod:modifications/umod:mod')) {
	my $title=$modification->findvalue('@title');
	my $full_name=$modification->findvalue('@full_name');
	my $record_id=$modification->findvalue('@record_id');
	my $visible=0;
	my $mass;
	foreach my $mono_mass ($modification->getElementsByTagName('umod:delta')) {
		$mass=$mono_mass->findvalue('@mono_mass');
	}
	foreach my $specificity ($modification->getElementsByTagName('umod:specificity')) {
		my $hidden=		$specificity->findvalue('@hidden');
		my $site=		$specificity->findvalue('@site');
		my $position=	$specificity->findvalue('@position');
		$visible=1 if $hidden==0;
	}
		print $title."\t".$full_name."\t".$record_id."\t".$visible."\t".$mass."\n";
}
